﻿namespace ZeBobo5.LibraryHelper.Orm
{
    public class OrmOrderByFactory<A>
        where A : OrmDataElementBase<A>
    {
        private readonly OrmFieldBase<A>[] _fields;
        private readonly OrmOrderType _orderType;

        private OrmOrderByFactory(OrmOrderType type, OrmFieldBase<A>[] fields)
        {
            _orderType = type;
            _fields = fields;
        }

        public OrmFieldBase<A>[] Fields
        {
            get
            {
                return _fields;
            }
        }

        internal OrmOrderType OrderType
        {
            get
            {
                return _orderType;
            }
        }

        public static OrmOrderByFactory<A> Asc(params OrmFieldBase<A>[] fields)
        {
            return new OrmOrderByFactory<A>(OrmOrderType.Asc, fields);
        }

        public static OrmOrderByFactory<A> Desc(params OrmFieldBase<A>[] fields)
        {
            return new OrmOrderByFactory<A>(OrmOrderType.Desc, fields);
        }

        #region Nested type: OrmOrderType

        internal enum OrmOrderType
        {
            Asc,
            Desc
        }

        #endregion
    }
}